<!doctype html public "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<html>
<head>
<title>
 Overview
</title>
<link rel ="stylesheet" type="text/css" href="stylesheet.css" title="Style">
<script>
function asd() {
	
		parent.document.title="MarkLogicPowerPointAddin.js Overview";
	
}
</script>
</head>
<body bgcolor="white" onload="asd();">

<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> 	<font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top">
<em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<center>
	
	   <h2>MarkLogicPowerPointAddin.js</h2>
	
</center>

	


<h4>Summary</h4>
<p>
	
		API documentation for MarkLogicPowerPointAddin.js



 http://www.marklogic.com 

 <BR/><BR/><B>Version: </B>1.1-1<BR/><BR/><B>Author:</B> Pete Aven pete.aven@marklogic.com
 <BR/>
	
</p>

<hr>


    <table border="1" cellpadding="3" cellspacing="0" width="100%">
    <tr bgcolor="#CCCCFF" class="TableHeadingColor">
    <td colspan=2><font size="+2">
    
        <b>Class Summary</b>
    
    </font></td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="MLA.html">MLA</a></b></td>
    <td>&nbsp;</td>
    </tr>
    
    <tr bgcolor="white" class="TableRowColor">
    <td width="15%"><b><a href="MLA/ShapeRangeView.html">MLA.ShapeRangeView</a></b></td>
    <td>A basic ShapeRangeView class.</td>
    </tr>
    
    </table>
    <hr/> 


<!-- ========== METHOD SUMMARY =========== -->

<!-- ========== END METHOD SUMMARY =========== -->


        <pre class="sourceview"><span class="comment">/* 
Copyright 2009-2010 Mark Logic Corporation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/</span>
<span class="comment">//import json2.js</span>
<span class="comment">/** <span class="attrib">@ignore</span> */</span>
<span class="reserved">if</span> (typeof(ml_scripts) == <span class="literal">'undefined'</span>) var ml_scripts = new Object();
<span class="comment">/** <span class="attrib">@ignore</span> */</span>
ml_js_import(<span class="literal">'js/json2.js'</span>);

<span class="comment">/** <span class="attrib">@ignore</span> */</span>
<span class="reserved">function</span> ml_js_import(jsFile) {
         <span class="reserved">if</span> (ml_scripts[jsFile] != null) <span class="reserved">return</span>;
         var scriptElt = document.createElement(<span class="literal">'script'</span>);
             scriptElt.type = <span class="literal">'text/javascript'</span>;
             scriptElt.src = jsFile;
         document.getElementsByTagName(<span class="literal">'head'</span>)[0].appendChild(scriptElt);
         ml_scripts[jsFile] = jsFile; 
}
<span class="comment">/** 
 * <span class="attrib">@fileoverview</span>  API documentation for MarkLogicPowerPointAddin.js
 *
 *
 *
 * {<span class="attrib">@link</span> http://www.marklogic.com} 
 *
 * <span class="attrib">@author</span> Pete Aven pete.aven<span class="attrib">@marklogic</span>.com
 * <span class="attrib">@version</span> 1.1-1
 */</span>

<span class="comment">/**
 * The MLA namespace is used for global attribution. The methods within this namespace provide ways of interacting with an active Open XML document through a WebBrowser control. The control must be deployed within an Addin in Office 2007.
 *
 * The functions here provide ways for interacting with the active presentation in PowerPoint ; however, the functions getCustomXMLPart(), getCustomXMLPartIds(), addCustomXMLPart(), and deleteCustomXMLPart() will work for any Open XML package, provided they are used within the context of an Addin for the appropriate Office application.
 */</span>
<span class="comment">/*var MLA = {};*/</span>

<span class="reserved">function</span> MLA(){
      <span class="reserved">this</span>.getClassName = <span class="reserved">function</span>(){
      <span class="reserved">return</span> <span class="literal">"MLA"</span>;
   
      }
}

<span class="comment">/** <span class="attrib">@ignore</span> */</span>
MLA.version = { <span class="literal">"release"</span> : <span class="literal">"1.1-1"</span> };

<span class="comment">/** <span class="attrib">@ignore</span> */</span>
MLA.SimpleRange = <span class="reserved">function</span>(begin,finish){
	<span class="reserved">this</span>.start = begin;
	<span class="reserved">this</span>.end = finish;

};

<span class="comment">/** <span class="attrib">@ignore</span> */</span>
String.<span class="reserved">prototype</span>.trim = <span class="reserved">function</span>() {
	<span class="reserved">return</span> <span class="reserved">this</span>.replace(/^\s+|\s+$/g,<span class="literal">""</span>);
}


<span class="comment">/**
 * Returns version of MarkLogicPowerPointAddin.js library.
 * <span class="attrib">@return</span> the version of MarkLogicWordAddin.js
 * <span class="attrib">@type</span> string
 */</span>
MLA.getVersion = <span class="reserved">function</span>()
{
	<span class="reserved">return</span> MLA.version.release;
}

<span class="comment">/** <span class="attrib">@ignore</span> */</span>
MLA.errorCheck = <span class="reserved">function</span>(message)
{
	var returnVal = null;
        var errStr = message.substring(0,6);
	var len = message.length;
        var errMsg = message.substring(7,len);

        <span class="reserved">if</span>(errStr==<span class="literal">"error:"</span>)
		returnVal=errMsg;

	<span class="reserved">return</span> returnVal;

}
<span class="comment">/** Utility function for creating Microsoft.XMLDOM object from string.
 *
 *<span class="attrib">@param</span> xmlString the string to be loaded into a XMLDOM object.  The string must be serialized, well-formed XML.
 *<span class="attrib">@return</span> Microsoft.XMLDOM object
 *<span class="attrib">@throws</span> Exception if unable to create the XMLDOM object
 */</span>
MLA.createXMLDOM = <span class="reserved">function</span>(xmlstring)
{
	try{
		var xmlDom = new ActiveXObject(<span class="literal">"Microsoft.XMLDOM"</span>);
       		xmlDom.async=false;
       		xmlDom.loadXML(xmlstring);
	}
	catch(err)
 	{
                throw(<span class="literal">"Error: Not able to create XMLDOM from string.  Make sure XML is well formed. "</span>);
	}

        <span class="reserved">if</span>(xmlDom.text==<span class="literal">""</span> &amp;&amp; xmlDom.xml == <span class="literal">""</span>)
                throw(<span class="literal">"Error: Not able to create XMLDOM from string.  Make sure XML is well formed. "</span>);

   <span class="reserved">return</span> xmlDom;
}

<span class="comment">/** <span class="attrib">@ignore</span> */</span>
MLA.unescapeXMLCharEntities = <span class="reserved">function</span>(stringtoconvert)
{
	var unescaped = <span class="literal">""</span>;
	unescaped = stringtoconvert.replace(/&amp;amp;/g,<span class="literal">"&amp;"</span>);
	unescaped = unescaped.replace(/&amp;lt;/g,  <span class="literal">"&lt;"</span>);
	unescaped = unescaped.replace(/&amp;gt;/g,  <span class="literal">"&gt;"</span>);
	unescaped = unescaped.replace(/&amp;quot;/g,<span class="literal">"\"</span><span class="literal">");
	unescaped = unescaped.replace(/&amp;apos;/g,"</span>\<span class="literal">'");
	return unescaped;
}
/** @ignore */
MLA.escapeXMLCharEntities = function(stringtoconvert)
{
	var escaped = "";
	escaped = stringtoconvert.replace(/&amp;/g,"&amp;amp;");
	escaped = escaped.replace(/&lt;/g, "&amp;lt;");
	escaped = escaped.replace(/&gt;/g, "&amp;gt;");
	escaped = escaped.replace(/\"/g,"&amp;quot;");
	escaped = escaped.replace(/\'</span>/g, <span class="literal">"&amp;apos;"</span>);
	<span class="reserved">return</span> escaped;
}
<span class="comment">/**
 * Returns ids for custom parts (not built-in) that are part of the active Open XML package. (.docx, .xlsx, .pptx, etc.)
 * <span class="attrib">@returns</span> the ids for custom XML parts in active Open XML package as array of string
 * <span class="attrib">@type</span> Array 
 */</span>
MLA.getCustomXMLPartIds = <span class="reserved">function</span>()
{ 
	var partIds = window.external.getCustomXMLPartIds();

	var errMsg = MLA.errorCheck(partIds);

	<span class="reserved">if</span>(errMsg!=null)
	  throw(<span class="literal">"Error: Not able to get CustomXMLPartIds; "</span>+errMsg);

	var customPartIds = partIds.split(<span class="literal">" "</span>);

	<span class="reserved">if</span>(customPartIds.length ==1)
	{
		<span class="reserved">if</span> (customPartIds[0] == null || customPartIds[0] == <span class="literal">""</span>)
		{
			customPartIds.length = 0;
		}
	}

	<span class="reserved">return</span> customPartIds;
}

<span class="comment">/**
 * Returns the custom XML part, identified by customXMLPartId, that is part of the active Open XML package. (.docx, .xlsx, .pptx, etc.)
 * <span class="attrib">@param</span> customXMLPartId the id of the custom part to be fetched from the active package
 * <span class="attrib">@return</span> the XML for the custom part as a DOM object. 
 * <span class="attrib">@type</span> Microsoft.XMLDOM object 
 * <span class="attrib">@throws</span> Exception if there is error retrieving the custom part 
 */</span>
MLA.getCustomXMLPart = <span class="reserved">function</span>(customXMLPartId)
{
	var customXMLPart = window.external.getCustomXMLPart(customXMLPartId);

	var errMsg = MLA.errorCheck(customXMLPart);

	<span class="reserved">if</span>(errMsg!=null){
	   throw(<span class="literal">"Error: Not able to getCustomXMLPart; "</span>+errMsg);
	}
        
	var v_cp;

	<span class="reserved">if</span>(customXMLPart==<span class="literal">""</span>)
	{
		v_cp=null;
	}
        <span class="reserved">else</span>
	{
        	v_cp = MLA.createXMLDOM(customXMLPart); 
	}

	<span class="reserved">return</span> v_cp;
}

<span class="comment">/** Adds custom part to active Open XML package.  Returns the id of the part added.
 *<span class="attrib">@param</span> customPartXML Either A) an XMLDOM object that is the custom part to be added to the active Open XML package, or B)The string serialization of the XML to be added as a custom part to the active Open XML package. ( The XML must be well-formed. )
 *<span class="attrib">@return</span> id for custom part added 
 *<span class="attrib">@type</span> string
 *<span class="attrib">@throws</span> Exception if unable to add custom part
 */</span>
MLA.addCustomXMLPart = <span class="reserved">function</span>(customPartXml)
{
	var v_customPart =<span class="literal">""</span>;
	<span class="reserved">if</span>(customPartXml.xml)
	{
               v_customPart=customPartXml.xml;
	}
	<span class="reserved">else</span>
	{
	       v_customPart=customPartXml
	}
	
	var newId = window.external.addCustomXMLPart(v_customPart);

	var errMsg = MLA.errorCheck(newId);
	<span class="reserved">if</span>(errMsg!=null)
	   throw(<span class="literal">"Error: Not able to addCustomXMLPart; "</span>+errMsg);

	<span class="reserved">if</span>(newId ==<span class="literal">""</span>)
	  newId=null;

	<span class="reserved">return</span> newId;
}

<span class="comment">/** Deletes custom part from Active Open XML package identified by id.
 *<span class="attrib">@param</span> customXMLPartId the id of the custom part to be deleted from the active Open XML package.
 *<span class="attrib">@throws</span> Exception if unable to delete custom part
 */</span>
MLA.deleteCustomXMLPart = <span class="reserved">function</span>(customXMLPartId)
{
	var deletedPart = window.external.deleteCustomXMLPart(customXMLPartId);

        var errMsg = MLA.errorCheck(deletedPart);
	<span class="reserved">if</span>(errMsg!=null)
	   throw(<span class="literal">"Error: Not able to deleteCustomXMLPart; "</span>+errMsg);
     
	<span class="reserved">if</span>(deletedPart==<span class="literal">""</span>)
	  deletedPart = null;

}

<span class="comment">/** <span class="attrib">@ignore</span> */</span>
MLA.isArray = <span class="reserved">function</span>(obj)
{
 <span class="reserved">return</span> obj.constructor == Array;
}

<span class="comment">/**
 *
 *Returns MLA.config. The fields for this object are version, url, and theme.  
version - the version of the Addin library, url - the url used by the Addin WebBrowser control, theme - the current color scheme used by Office. 
 *<span class="attrib">@throws</span> Exception if unable to create MLA.config object
 */</span>
MLA.getConfiguration = <span class="reserved">function</span>()
{
        var version = window.external.getAddinVersion();
	var color = window.external.getOfficeColor();
	var webUrl = window.external.getBrowserURL();

	<span class="reserved">if</span>(version == <span class="literal">""</span> || color == <span class="literal">""</span> || webUrl == <span class="literal">""</span>)
		throw(<span class="literal">"Error: Not able to access configuration info."</span>);

	MLA.config = {
		        <span class="literal">"version"</span>:version,
			<span class="literal">"url"</span>:webUrl,
			<span class="literal">"theme"</span>:color
	};

        <span class="reserved">return</span> MLA.config;	
}
<span class="comment">/** Inserts image into the Presentation.  
 *<span class="attrib">@param</span> url a url to XQuery module that will return the image when evaluated  
 *<span class="attrib">@param</span> user username for the MarkLogic Server the picuri connects with
 *<span class="attrib">@param</span> pwd password for the MarkLogic Server the picuri connects with
 *<span class="attrib">@type</span> string
 *<span class="attrib">@throws</span> Exception if unable to insert image
 */</span>
MLA.insertImage = <span class="reserved">function</span>(url,user,pwd)
{
	
	var inserted = window.external.InsertImage(url,user,pwd);
	var errMsg = MLA.errorCheck(inserted);

	<span class="reserved">if</span>(errMsg!=null)
	   throw(<span class="literal">"Error: Not able to insertImage; "</span>+errMsg);

	<span class="reserved">return</span> inserted;
}

<span class="comment">/** Inserts slide, identified by slideIdx,  into the active presentation at current slide position.  
 *<span class="attrib">@param</span> tmpPath the directory (including path) where the local copy of presentation will be saved.  
 *<span class="attrib">@param</span> filename the name of the .pptx file
 *<span class="attrib">@param</span> slideIdx the index of the slide within the source powerpoint file to be copied
 *<span class="attrib">@param</span> url the url of the .pptx to be downloaded
 *<span class="attrib">@param</span> user the username of the MarkLogic Server the url connects with
 *<span class="attrib">@param</span> pwd the password of the MarkLogic Server the url connects with
 *<span class="attrib">@param</span> retain true or false setting determines whether background style of copied slide will be retained when copied to active presentation
 *<span class="attrib">@type</span> string
 *<span class="attrib">@throws</span> Exception if unable to copy slide to active presentation 
 */</span>
MLA.insertSlide = <span class="reserved">function</span>(tmpPath, filename, slideidx, url, user, pwd,retain)
{
	var msg = window.external.insertSlide(tmpPath,filename,slideidx,url,user,pwd,retain);
	var errMsg = MLA.errorCheck(msg);
	<span class="reserved">if</span>(errMsg!=null)
	   throw(<span class="literal">"Error: Not able to insertSlide; "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/**
 * Returns the path being used for the /temp dir on the client system.
 * <span class="attrib">@return</span> /temp path on client system
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to retrieve the /temp path
 */</span>
MLA.getTempPath = <span class="reserved">function</span>()
{
	<span class="comment">//alert("IN HERE");</span>
	var msg=window.external.getTempPath();
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to getTempPath; "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/** Opens .pptx  into PowerPoint from local copy saved to client from MarkLogic.
 *<span class="attrib">@param</span> tmpPath the directory (including path) where the local copy of presentation will be saved.  
 *<span class="attrib">@param</span> docuri the uri of the .pptx within MarkLogic
 *<span class="attrib">@param</span> url the url for fetching the .pptx to be downloaded
 *<span class="attrib">@param</span> user the username for the MarkLogic Server the url connects with
 *<span class="attrib">@param</span> pwd the password for the MarkLogic Server the url connects with
 *<span class="attrib">@type</span> string
 *<span class="attrib">@throws</span> Exception if unable to download and open local copy 
 */</span>
MLA.openPPTX = <span class="reserved">function</span>(tmpPath, docuri, url, user, pwd)
{
	<span class="comment">//alert("tmpPath: "+tmpPath+" docuri: "+docuri+" url:"+url+" user/pwd:"+ user+pwd);</span>
	var msg = window.external.openPPTX(tmpPath, docuri, url, user, pwd);
        var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to openPPTX; "</span>+errMsg);

	<span class="reserved">return</span> msg;
}
<span class="comment">/** Inserts text into the Presentation at cursor position.  
 *<span class="attrib">@param</span> text text to inser
 *<span class="attrib">@type</span> string
 *<span class="attrib">@throws</span> Exception if unable to insert text
 */</span>
MLA.insertText = <span class="reserved">function</span>(text)
{
	var msg = window.external.insertText(text);
        var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to insertText; "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/** Embeds OLE into the Presentation. the OLE is downloaded to client and saved into Presentation from local file.
 *<span class="attrib">@param</span> tmpPath the directory (including path) where the local copy of object to be embedded will be saved.  
 *<span class="attrib">@param</span> filename the name of the file to be embedded. tmpPath + filename should be the name and path of file on client.  
 *<span class="attrib">@param</span> url the url for the file to be downloaded and embedded
 *<span class="attrib">@param</span> user username for MarkLogic Server url connects with
 *<span class="attrib">@param</span> pwd password for MarkLogic Server url connects with
 *<span class="attrib">@type</span> string
 *<span class="attrib">@throws</span> Exception if unable to embedOLE 
 */</span>
MLA.embedOLE = <span class="reserved">function</span>(tmpPath, title, url, usr, pwd)
{
	var msg = window.external.embedOLE(tmpPath, title, url, usr, pwd);
	var errMsg = MLA.errorCheck(msg);
        <span class="comment">//alert("errMsg"+errMsg);</span>
        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to embedOLE; "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/** Launches Windows form on client as simple SaveAs text box. 
 * <span class="attrib">@return</span> text entered by user as filename into form
 * <span class="attrib">@type</span> string 
 *<span class="attrib">@throws</span> Exception if unable to return text 
 */</span>
MLA.useSaveFileDialog =<span class="reserved">function</span>()
{
	var msg=window.external.useSaveFileDialog();
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to embedOLE; "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/** Converts .pptx filename to image directory name.
 * <span class="attrib">@param</span> filename the name to be converted
 * <span class="attrib">@return</span> converted_name replaces .pptx of filename with _PNG 
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to retrieve the /temp path
 */</span>
MLA.convertFilenameToImageDir = <span class="reserved">function</span>(filename)
{
	<span class="comment">//alert("IN HERE");</span>
	var msg=window.external.convertFilenameToImageDir(filename);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to convert filename to image directory name; "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/**
 * Returns the path being used for the active Presentation on the client system.
 * <span class="attrib">@return</span> path path is path for where current Presentation is saved on client
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to retrieve the presentation path
 */</span>
MLA.getPresentationPath = <span class="reserved">function</span>()
{
	var msg=window.external.getPresentationPath();
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to getPresentationPath; "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/**
 * Returns the name being used for the active Presentation on the client system.
 * <span class="attrib">@return</span> presentation_name the name of the active Presentation
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to retrieve the presentation name
 */</span>
MLA.getPresentationName = <span class="reserved">function</span>()
{
	var msg=window.external.getPresentationName();
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to getPresentationName; "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/**
 * Saves .pptx for active Presentation on the client system.
 * <span class="attrib">@param</span> filename the filename (including path) to save Presentation as on client system
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to save local copy
 */</span>
MLA.saveLocalCopy = <span class="reserved">function</span>(filename)
{
	var msg = window.external.saveLocalCopy(filename);
        var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to saveLocalCopy; "</span>+errMsg);

	<span class="reserved">return</span> msg;
}


<span class="comment">/** Saves active Presentation to MarkLogic from client system.  .pptx being saved to ML must already exist (be saved) on client and have both path and name.
 *<span class="attrib">@param</span> filename the name of the file (including path) to be saved to MarkLogic  
 *<span class="attrib">@param</span> url the url on MarkLogic that the client calls to upload the presentation
 *<span class="attrib">@param</span> user username for MarkLogic Server url connects with
 *<span class="attrib">@param</span> pwd password for MarkLogic Server url connects with
 *<span class="attrib">@type</span> string
 *<span class="attrib">@throws</span> Exception if unable to save the active Presentation
 */</span>
MLA.saveActivePresentation = <span class="reserved">function</span>(filename, url, user, pwd)
{

	var msg=window.external.saveActivePresentation(filename, url, user, pwd);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to saveActivePresentation; "</span>+errMsg);

	<span class="reserved">return</span> msg;
}


<span class="comment">/** Saves directory of images on client. saves this directory and its contents to MarkLogic.
 *<span class="attrib">@param</span> imgdir the name of the directory (including path) where to save the images on the client system  
 *<span class="attrib">@param</span> url the url on MarkLogic that the client calls to upload the image directory and contents to MarkLogic
 *<span class="attrib">@param</span> user username for MarkLogic Server url connects with
 *<span class="attrib">@param</span> pwd password for MarkLogic Server url connects with
 *<span class="attrib">@type</span> string
 *<span class="attrib">@throws</span> Exception if unable to save images
 */</span>
MLA.saveImages = <span class="reserved">function</span>(imgdir, url, user, pwd)
{
	var msg = window.external.saveImages(imgdir,url,user,pwd);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to saveImages; "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/** Saves Presentation on client as .pptx. Saves same .pptx to MarkLogic. Saves images for Presentation to client.  Saves same images to MarkLogic.
 *<span class="attrib">@param</span> saveasdir the name of the directory (including path) where to save the local copies
 *<span class="attrib">@param</span> saveasname the name to save the .pptx as (no path)
 *<span class="attrib">@param</span> url the url on MarkLogic that the client calls to upload the Presentation and images to MarkLogic
 *<span class="attrib">@param</span> user username for MarkLogic Server url connects with
 *<span class="attrib">@param</span> pwd password for MarkLogic Server url connects with
 *<span class="attrib">@type</span> string
 *<span class="attrib">@throws</span> Exception if unable to save active Presentation and images
 */</span>
MLA.saveActivePresentationAndImages = <span class="reserved">function</span>(saveasdir, saveasname, url, user, pwd)
{
	var msg=window.external.saveActivePresentationAndImages(saveasdir, saveasname, url, user, pwd);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to saveActivePresentationAndImages; "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/** Inserts JSON string as table in Active Presentation.  
 * see template example in insertJSONTable() found in Samples/officesearch/officesearch.js for required JSON format.
 *<span class="attrib">@param</span> table the JSON representation of the table to be inserted
 *<span class="attrib">@type</span> string
 *<span class="attrib">@throws</span> Exception if unable to save insert table into Presentation
 */</span>
MLA.insertJSONTable = <span class="reserved">function</span>(table)
{
	var msg=window.external.insertJSONTable(table);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to insertJSONTable(); "</span>+errMsg);

	<span class="reserved">return</span> msg;
}


<span class="comment">/* ================== BEGIN Added for PPT TK UPDATE  ==================================== */</span>

<span class="comment">/** Returns slide name of active slide.
 * <span class="attrib">@return</span> slideName
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to retrieve the slide name
 */</span>
MLA.getSlideName = <span class="reserved">function</span>()
{
	var msg = window.external.getSlideName();
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to getSlideName(); "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/** Returns index of active slide.
 * <span class="attrib">@return</span> slideIndex 
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to retrieve the slide index
 */</span>
MLA.getSlideIndex = <span class="reserved">function</span>()
{
	var msg = window.external.getSlideIndex();
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to getSlideIndex(); "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/** Returns count of slides for active presentation.
 * <span class="attrib">@return</span> slideCount 
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to retrieve the slide count
 */</span>
MLA.getPresentationSlideCount = <span class="reserved">function</span>()
{
	var msg = window.external.getPresentationSlideCount();
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to getPresentationSlideCount(); "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/** Adds tag to active presentation
 * <span class="attrib">@param</span> tagName the name of the tag
 * <span class="attrib">@param</span> tagValue the value of the tag
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to add tag to presentation
*/</span>
MLA.addPresentationTag = <span class="reserved">function</span>(tagName, tagValue)
{ 
	var msg = window.external.addPresentationTag(tagName,tagValue);

	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to addPresentationTag(); "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/** Deletes tag from active presentation.
 * <span class="attrib">@param</span> tagName the name of the tag to be deleted
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to delete the tag from the presentation
 */</span>
MLA.deletePresentationTag = <span class="reserved">function</span>(tagName)
{
        var msg = window.external.deletePresentationTag(tagName);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to deletePresentationTag(); "</span>+errMsg);

	<span class="reserved">return</span> msg;

}

<span class="comment">/** Adds tag to slide.
 * <span class="attrib">@param</span> slideIndex the index of the slide to be tagged
 * <span class="attrib">@param</span> tagName the name of the tag
 * <span class="attrib">@param</span> tagValue the value of the tag
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to add tag to slide 
 */</span>
MLA.addSlideTag = <span class="reserved">function</span>(slideIndex, tagName, tagValue)
{
	var msg = window.external.addSlideTag(slideIndex, tagName, tagValue);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to addSlideTag(); "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/** Deletes tag from slide.
 * <span class="attrib">@param</span> slideIndex the index of the slide
 * <span class="attrib">@param</span> tagName the name of the tag to be deleted
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to delete slide tag 
 */</span>
MLA.deleteSlideTag = <span class="reserved">function</span>(slideIndex, tagName)
{
	var msg = window.external.deleteSlideTag(slideIndex, tagName);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to deleteSlideTag(); "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/** Adds tag to shape.
 * <span class="attrib">@param</span> slideIndex the index of the slide containing the shape 
 * <span class="attrib">@param</span> shapeName the name of the shape to be tagged 
 * <span class="attrib">@param</span> tagName the name of the tag
 * <span class="attrib">@param</span> tagValue the value of the tag
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to add shape tag
 */</span>
MLA.addShapeTag = <span class="reserved">function</span>(slideIndex, shapeName, tagName, tagValue)
{
	var msg = window.external.addShapeTag(slideIndex, shapeName, tagName, tagValue);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to addShapeTag(); "</span>+errMsg);

	<span class="reserved">return</span> msg;

}

<span class="comment">/** Deletes tag from shape.
 * <span class="attrib">@param</span> slideIndex the index of the slide containing the shape 
 * <span class="attrib">@param</span> shapeName the name of the tagged shape 
 * <span class="attrib">@param</span> tagName the name of the tag to be deleted
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to delete shape tag
 */</span>
MLA.deleteShapeTag = <span class="reserved">function</span>(slideIndex, shapeName, tagName)
{
	var msg = window.external.deleteShapeTag(slideIndex, shapeName, tagName);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to deleteShapeTag(); "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/** Adds tags (tag names and associated values) to shape from jsonSerialization of tags.  You can get the json serialization of tags by using MLA.jsonStringify(shapeRangeView.tags)
 * <span class="attrib">@param</span> slideIndex the index of the slide containing the shape 
 * <span class="attrib">@param</span> shapeName the name of the shape to be tagged 
 * <span class="attrib">@param</span> jsonTags the tags (name, value) to be added to the shape
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to add shape tags 
 */</span>
MLA.addShapeTags = <span class="reserved">function</span>(slideIndex, shapeName, jsonTags)
{
 	var msg = window.external.addShapeTags(slideIndex, shapeName, jsonTags);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to addShapeTags(); "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/** Adds tags (tag names and associated values) to slide from jsonSerialization of tags.  You can get the json serialization of tags by using MLA.jsonStringify(shapeRangeView.tags) or MLA.jsonStringify(MLA.getSlideTags()). Most likely, you'd save the serialization in a custom part and apply to new presentations when reusing slide.
 * <span class="attrib">@param</span> slideIndex the index of the slide containing the shape 
 * <span class="attrib">@param</span> jsonTags the tags (name, value) to be added to the slide
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to add slide tags 
 */</span>
MLA.addSlideTags = <span class="reserved">function</span>(slideIndex, jsonTags)
{
 	var msg = window.external.addSlideTags(slideIndex, jsonTags);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to addSlideTags(); "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/** Adds tags (tag names and associated values) to active presentation from jsonSerialization of tags.  You can get the json serialization of tags by using MLA.jsonStringify(MLA.getPresentationTags()).  Most likely, you'd save the serialization in a custom XML part and apply to new presentations based on some business logic.
 * <span class="attrib">@param</span> jsonTags the tags (name, value) to be added to the presentation 
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to add presentation tags 
 */</span>
MLA.addPresentationTags = <span class="reserved">function</span>(jsonTags)
{
 	var msg = window.external.addPresentationTags(jsonTags);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to addPresentationTags(); "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">//adds tag to selected range where addShapeTag adds tag to single shape, that may or may not be currently selected</span>
<span class="comment">/** Adds tag to all selected shapes in the active slide
 * <span class="attrib">@param</span> tagName the name of the tag
 * <span class="attrib">@param</span> tagValue the value of the tag 
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to add shape range tags
 */</span>
MLA.addShapeRangeTag = <span class="reserved">function</span>(tagName, tagValue)
{
	var msg = window.external.addShapeRangeTag(tagName, tagValue);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to addShapeRangeTag(); "</span>+errMsg);

	<span class="reserved">return</span> msg;	
}

<span class="comment">/**
 * Returns the count of how many shapes are currently selected in the active slide.
 * <span class="attrib">@return</span> shapeCount the number of currently selected shapes
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to get shape range count
 */</span>
MLA.getShapeRangeCount = <span class="reserved">function</span>()
{
	var msg = window.external.getShapeRangeCount();
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to getShapeRangeCount(); "</span>+errMsg);

	<span class="reserved">return</span> msg;	
}

<span class="comment">/**
 * Returns the name of the currently selected shape.
 * <span class="attrib">@return</span> shapeName the name of the shape
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to retrieve the shape range name
 */</span>
MLA.getShapeRangeName = <span class="reserved">function</span>()
{
	var msg = window.external.getShapeRangeName();
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to getShapeRangeName(); "</span>+errMsg);

	<span class="reserved">return</span> msg;
}
<span class="comment">/**
 * Sets the name being used for the active Presentation on the client system.
 * <span class="attrib">@param</span> slideIndex the index of the slide containing the shape
 * <span class="attrib">@param</span> origName the original name of the shape
 * <span class="attrib">@param</span> newName the name to set for the shape
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to set shape range name
 */</span>
MLA.setShapeRangeName = <span class="reserved">function</span>(slideIndex, origName,newName)
{
	var msg = window.external.setShapeRangeName(slideIndex, origName, newName);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to setShapeRangeName(); "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">//no different than getShapeRangeName, just returns all selected instead of one</span>
<span class="comment">/**
 * Gets the names of all currently selected shapes in the active slide.
 * <span class="attrib">@return</span> then names of all currently selected shapes
 * <span class="attrib">@type</span> Array 
 * <span class="attrib">@throws</span> Exception if unable to get shape range name
 */</span>
MLA.getShapeRangeShapeNames = <span class="reserved">function</span>()
{
	var msg = window.external.getShapeRangeShapeNames();
	var errMsg = MLA.errorCheck(msg);

	var tokens = msg.split(<span class="literal">"|"</span>);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to getShapeRangeShapeNames(); "</span>+errMsg);

	<span class="reserved">return</span> tokens;
}

<span class="comment">/**
 * Gets the names of all shapes for the slide specified by slideIndex.
 * <span class="attrib">@param</span> slideIndex the index of the slide
 * <span class="attrib">@return</span> then names of all shapes on the slide
 * <span class="attrib">@type</span> Array 
 * <span class="attrib">@throws</span> Exception if unable to get slide shape names
 */</span>
MLA.getSlideShapeNames = <span class="reserved">function</span>(slideIndex)
{
	var msg = window.external.getSlideShapeNames(slideIndex);
	var errMsg = MLA.errorCheck(msg);

	var tokens = msg.split(<span class="literal">"|"</span>);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to getShapeRangeShapeNames(); "</span>+errMsg);

	<span class="reserved">return</span> tokens;

}

<span class="comment">/** <span class="attrib">@ignore</span> */</span>
MLA.getShapeRangeInfoORIG = <span class="reserved">function</span>(shapeName)
{
	var msg = window.external.getShapeRangeInfo(shapeName);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to getShapeRangeInfo(); "</span>+errMsg);

	var shape =  eval(<span class="literal">'('</span>+msg+<span class="literal">')'</span>);
	
	<span class="reserved">return</span> shape;
}

<span class="comment">/**
 * Gets  a shapeRangeView object
 * <span class="attrib">@param</span> slideIndex the index of the slide containing the shape
 * <span class="attrib">@param</span> shapeName the name of the shape
 * <span class="attrib">@return</span> ShapeRangeVIew
 * <span class="attrib">@type</span> ShapeRangeView
 * <span class="attrib">@throws</span> Exception if unable to get shape range view
 */</span>
MLA.getShapeRangeView = <span class="reserved">function</span>(slideIndex, shapeName)
{
	var msg = window.external.getShapeRangeView(slideIndex, shapeName);
	var errMsg = MLA.errorCheck(msg);

	<span class="comment">//alert("msg");</span>

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to getShapeRangeView(); "</span>+errMsg);

	try{ 
		<span class="comment">//alert("JSON: "+msg);</span>
         	var tmpshape =  eval(<span class="literal">'('</span>+msg+<span class="literal">')'</span>);
		<span class="comment">//alert(tmpshape.paragraphs.length);</span>
	}catch(err)
	{ 
		alert(<span class="literal">"ERROR: "</span> +err.description);
	}


	var shapeTags = tmpshape.tags;
	var shapeParas = tmpshape.paragraphs;
	var picFormat = tmpshape.pictureFormat;

	delete tmpshape.tags;
	delete tmpshape.paragraphs;
	delete tmpshape.pictureFormat;

	var shapeRangeView = new MLA.ShapeRangeView();
	shapeRangeView.shape = tmpshape;
	shapeRangeView.tags = shapeTags;
	shapeRangeView.paragraphs = shapeParas;
	shapeRangeView.pictureFormat = picFormat;
	
	<span class="reserved">return</span> shapeRangeView;
}

<span class="comment">/**
 * Gets the json serialization of tags for the active presentation.  
 * <span class="attrib">@return</span> the json serialization of tags for the active presentation. 
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to get presentation tags
 */</span>
MLA.getPresentationTags = <span class="reserved">function</span>()
{
	var msg = window.external.getPresentationTags();
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to getPresentationTags(); "</span>+errMsg);

	var tags = eval(<span class="literal">'('</span>+msg+<span class="literal">')'</span>);

	<span class="reserved">return</span> tags;

}

<span class="comment">/**
 * Gets the json serialization of tags for a slide in the active presentation.  
 * <span class="attrib">@param</span> slideIndex the index of the slide
 * <span class="attrib">@return</span> json serialization of tags for a slide
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to get slide tags
 */</span>
MLA.getSlideTags = <span class="reserved">function</span>(slideIndex)
{
	var msg = window.external.getSlideTags(slideIndex);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to getSlideTags(); "</span>+errMsg);

	var tags = eval(<span class="literal">'('</span>+msg+<span class="literal">')'</span>);

	<span class="reserved">return</span> tags;
}

<span class="comment">/**
 * Add a shape to the active presentation
 * <span class="attrib">@param</span> slideIndex the index of the slide to add the shape to
 * <span class="attrib">@param</span> shapeRangeView the json serialization of a ShapeRangeView object.
 * <span class="attrib">@return</span> shapeName the name of the new shape 
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to add shape
 */</span>
MLA.addShape = <span class="reserved">function</span>(slideIndex, shapeRangeView)
{
	var msg=<span class="literal">""</span>;
	try
	{
	  var shape = MLA.jsonStringify(shapeRangeView.shape);
	  var tags = MLA.jsonStringify(shapeRangeView.tags);
	  var paragraphs = MLA.jsonGetParagraphs(shapeRangeView.paragraphs);

          msg=window.external.addShape(slideIndex,shape, tags, paragraphs);

	  var errMsg = MLA.errorCheck(msg);

          <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to addShape(); "</span>+errMsg);

	}catch(err)
	{
		throw(<span class="literal">"Error: Not able to addShape() JS; "</span>+ err.description);
	}

	<span class="reserved">return</span> msg;


}

<span class="comment">/**
 * Adds a slide to the active presentation.  
 * <span class="attrib">@param</span> slideIndex the index of where to add the slide
 * <span class="attrib">@param</span> customLayout the layout to use for the added slide
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to add slide 
 */</span>
MLA.addSlide = <span class="reserved">function</span>(slideIndex, customLayout)
{
  	var msg = window.external.addSlide(slideIndex, customLayout);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to addSlide(); "</span>+errMsg);

	<span class="reserved">return</span> msg; <span class="comment">//should return slide Index or Name</span>
}

<span class="comment">/**
 * Deletes a slide from the active presentation.  
 * <span class="attrib">@param</span> slideIndex the index of slide to delete
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to delete slide 
 */</span>
MLA.deleteSlide = <span class="reserved">function</span>(slideIndex)
{
  	var msg = window.external.deleteSlide(slideIndex);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to deleteSlide(); "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/**
 * Deletes a shape from the active slide in the active presentation.  
 * <span class="attrib">@param</span> slideIndex the index of slide containing shape to be deleted
 * <span class="attrib">@param</span> shapeName the name of the shape to be deleted
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to delete shape 
 */</span>
MLA.deleteShape = <span class="reserved">function</span>(slideIndex, shapeName)
{
	var msg = window.external.deleteShape(slideIndex, shapeName);
	var errMsg = MLA.errorCheck(msg);

        <span class="reserved">if</span>(errMsg!=null) 
        	throw(<span class="literal">"Error: Not able to deleteShape(); "</span>+errMsg);

	<span class="reserved">return</span> msg;
}

<span class="comment">/** <span class="attrib">@ignore</span> */</span>
MLA.jsonGetParagraphs =  <span class="reserved">function</span>(paragraphs)
{
        var jsonPara = <span class="literal">"{"</span>;
	jsonPara += <span class="literal">"\"</span>paragraphAlignment\<span class="literal">": ["</span>;

        <span class="reserved">for</span>(var j =0;j&lt;paragraphs.length;j++)
	{
		var para = paragraphs[j];
		jsonPara += <span class="literal">"\"</span><span class="literal">"+para.paragraphAlignment+"</span>\<span class="literal">","</span>;
        }

	<span class="reserved">if</span>(paragraphs.length&gt;=1)
	  jsonPara = jsonPara.substring(0,jsonPara.length-1);

	jsonPara += <span class="literal">"],"</span>;

	<span class="comment">//</span>
	jsonPara +=  <span class="literal">"\"</span>paragraphBulletType\<span class="literal">": ["</span>;

        <span class="reserved">for</span>(var j =0;j&lt;paragraphs.length;j++)
	{
		var para = paragraphs[j];
		jsonPara += <span class="literal">"\"</span><span class="literal">"+para.paragraphBulletType+"</span>\<span class="literal">","</span>;
        }

	<span class="reserved">if</span>(paragraphs.length&gt;=1)
	  jsonPara = jsonPara.substring(0,jsonPara.length-1);

	jsonPara += <span class="literal">"],"</span>;
	<span class="comment">//</span>

	jsonPara += <span class="literal">"\"</span>runs\<span class="literal">": ["</span>;

	var runLength;
	<span class="reserved">for</span>(var k=0; k&lt;paragraphs.length;k++)
	{
		var para = paragraphs[k];
                
		runLength=para.runs.length;
		<span class="reserved">for</span>(var l =0;l&lt;para.runs.length;l++)
	        {
			var run = para.runs[l];
		        jsonPara+=<span class="literal">"["</span>+<span class="literal">"\"</span><span class="literal">"+k+"</span>\<span class="literal">",\"</span><span class="literal">"+run.fontName+"</span>\<span class="literal">",\"</span><span class="literal">"+
				                     run.fontSize+"</span>\<span class="literal">",\"</span><span class="literal">"+
						     run.fontRGB+"</span>\<span class="literal">",\"</span><span class="literal">"+
						     run.fontItalic +"</span>\<span class="literal">",\"</span><span class="literal">"+
						     run.fontUnderline +"</span>\<span class="literal">",\"</span><span class="literal">"+
						     run.fontBold +"</span>\<span class="literal">",\"</span><span class="literal">"+
						     run.text+"</span>\<span class="literal">"],"</span>;
		}
	
	}
	<span class="reserved">if</span>(runLength&gt;=1)
            jsonPara = jsonPara.substring(0,jsonPara.length-1);

	jsonPara +=<span class="literal">"]}"</span>;

	<span class="reserved">return</span> jsonPara;

}

<span class="comment">/**
 * Serializes an object as JSON.  
 * <span class="attrib">@param</span> jsObject the object to be serialized as JSON
 * <span class="attrib">@param</span> replacer optional replacer parameter
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to stringify
 */</span>
MLA.jsonStringify = <span class="reserved">function</span>(jsObject, replacer)
{
	var jsonString;

	try
	{
            jsonString = JSON.stringify(jsObject)
	}
	catch(err)
	{
		throw(<span class="literal">"Error: Not able to stringify(); "</span>+err.description);
	}

	<span class="reserved">return</span> jsonString;

}

<span class="comment">/**
 * Deserializes a JSON string into an object.
 * <span class="attrib">@param</span> jsString the JSON string to convert to object.
 * <span class="attrib">@param</span> reviver optional reviver parameter
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to parse
 */</span>
MLA.jsonParse = <span class="reserved">function</span>(jsonString, reviver)
{
	var jsonObj;

	try
	{
            jsonObj = JSON.parse(jsonString)
	}
	catch(err)
	{
		throw(<span class="literal">"Error: Not able to parse(); "</span>+err.description);
	}

	<span class="reserved">return</span> jsonObj;
}

<span class="comment">/**
 * Sets the picture attributes for an inserted msoPicture shape.
 * <span class="attrib">@param</span> slideIndex the index of the slide containing the picture
 * <span class="attrib">@param</span> shapeName the name of the picture shape
 * <span class="attrib">@param</span> jsonPicFormat the JSON serialization of picture format, available by using MLA.jsonStringify(shapeRangeView.pictureFormat)
 * <span class="attrib">@type</span> string
 * <span class="attrib">@throws</span> Exception if unable to set picture format 
 */</span>
MLA.setPictureFormat = <span class="reserved">function</span>(slideIndex, shapeName, jsonPicFormat)
{
         
     msg=window.external.setPictureFormat(slideIndex, shapeName, jsonPicFormat);
     var errMsg = MLA.errorCheck(msg);

     <span class="reserved">if</span>(errMsg!=null) 
         throw(<span class="literal">"Error: Not able to addShape(); "</span>+errMsg);

     <span class="reserved">return</span> msg;
}

<span class="comment">/**
 * Create a new ShapeRangeView instance. 
 * <span class="attrib">@class</span> A basic ShapeRangeView class.
 */</span>
MLA.ShapeRangeView = <span class="reserved">function</span>()
{
	var shape;
	var paragraphs;
	var tags;
	var pictureFormat;
}

</pre>
	<hr>



<!-- ========== START OF NAVBAR ========== -->
<a name="navbar_top"><!-- --></a>
<table border="0" width="100%" cellpadding="1" cellspacing="0">
<tr>
<td colspan=2 bgcolor="#EEEEFF" class="NavBarCell1">
<a name="navbar_top_firstrow"><!-- --></a>
<table border="0" cellpadding="0" cellspacing="3">
  <tr align="center" valign="top">
  
  
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-summary.html"><font class="NavBarFont1"><b>Overview</b></font></a>&nbsp;</td>
  <td bgcolor="#FFFFFF" class="NavBarCell1Rev">	&nbsp;<font class="NavBarFont1Rev"><b>File</b></font>&nbsp;</td>
  

  <td bgcolor="#FFFFFF" class="NavBarCell1"> <font class="NavBarFont1">Class</font>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="overview-tree.html"><font class="NavBarFont1"><b>Tree</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="index-all.html"--><font class="NavBarFont1"><b>Index</b></font></a>&nbsp;</td>
  <td bgcolor="#EEEEFF" class="NavBarCell1">    <a href="help-doc.html"><font class="NavBarFont1"><b>Help</b></font></a>&nbsp;</td>
  </tr>
</table>
</td>
<td bgcolor="#EEEEFF" align="right" valign="top"><em>
<b></b></em>
</td>
</tr>

<tr>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
&nbsp;PREV&nbsp;
&nbsp;NEXT</font></td>
<td bgcolor="white" class="NavBarCell2"><font size="-2">
  <a href="index.html" target="_top"><b>FRAMES</b></a>  &nbsp;
&nbsp;<a href="overview-summary.html" target="_top"><b>NO FRAMES</b></a>
&nbsp;&nbsp;
<script>
  <!--
  if(window==top) {
    document.writeln('<A HREF="allclasses-noframe.html" TARGET=""><B>All Classes</B></A>');
  }
  //-->
</script>
<noscript>
<a href="allclasses-noframe.html" target=""><b>All Classes</b></a>
</noscript>
</font></td>
</tr>
</table>
<!-- =========== END OF NAVBAR =========== -->

<hr>
<font size="-1">

</font>
<div class="jsdoc_ctime">Documentation generated by <a href="http://jsdoc.sourceforge.net/" target="_parent">JSDoc</a> on Thu Sep 23 16:38:15 2010</div>
</body>
</html>
